package com.situ.spring.proxy;

import com.situ.spring.service.IStudentService;
import com.situ.spring.service.impl.StudentServiceImpl;
import org.junit.Test;

public class Client {

    public static void main(String[] args) {
        DongShiZhang dongShiZhang = new DongShiZhang();
        IQianzi mishu = new MiShu(dongShiZhang);
        mishu.qianzi();
    }

    @Test
    public void test1() {
        DongShiZhang dongShiZhang = new DongShiZhang();
        //返回的是代理对象
        IQianzi qianzi = (IQianzi) ProxyFactory.getProxyInstance(dongShiZhang);
        qianzi.qianzi();
    }

    @Test
    public void test2() {
        StudentServiceImpl studentService = new StudentServiceImpl();
        //返回的是代理对象
        IStudentService service = (IStudentService) ProxyFactory.getProxyInstance(studentService);
        service.selectAll();
        service.deleteById(1);
    }
}
